import express from "express";
import multer from "multer";
import userhandle from "./handle/userhandle";
import reg from "./middleware/reg";
import { storage } from "./middleware/file";
import { filestr } from "../config";
import isroot from "./middleware/isroot";
import uploadhandle from "./middleware/upload@";

const router = express.Router();

router.post("/login", reg.user, userhandle.login);
router.post("/registry", reg.user, userhandle.registry);
router.get("/isname", userhandle.isname);
router.post(
  "/userimg",
  multer({ storage }).single(filestr),
  uploadhandle,
  userhandle.userimg
);
router.post(
  "/articleimg",
  multer({ storage }).single(filestr),
  uploadhandle,
  userhandle.articleimg
);
router.post(
  "/theftarticleimg",
  multer({ storage }).single(filestr),
  uploadhandle,
  userhandle.theftarticleimg
);
router.post("/getuserlist", isroot, userhandle.getuserlist);
router.post("/rightchange", isroot, userhandle.changeright);

export default router;
